package com.freemypay.test.并发.捕获异常;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程run()方法中逃逸的异常无法捕获。
 * 即使在main中加了try-catch也没有作用。
 * @author yesixian
 * @date 2018年5月14日
 */
public class NaiveExceptionHandling {
	public static void main(String[] args) {
		try {
			ExecutorService exec = Executors.newCachedThreadPool();
			exec.execute(new ExceptionThread());
		} catch (Exception e) {
			System.out.println("Excepton has been handled!");
		}
	}
}
